package lxs.tool.liberator.work.controller;

import lxs.tool.liberator.common.base.result.Response;
import lxs.tool.liberator.work.pojo.Field;
import lxs.tool.liberator.work.service.FieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("work/field")
public class FieldController {
    @Autowired
    private FieldService fieldService;

    @GetMapping("getByEId")
    public Response getByEId(String id) {
        return fieldService.getByEId(id);
    }

    @GetMapping("deleteById")
    public Response deleteById(String id) {
        return fieldService.deleteById(id);
    }

    @GetMapping("add")
    public Response add(String eid, String key) {
        return fieldService.add(eid, key);
    }

    @PostMapping("update")
    public Response update(@RequestBody Field field) {
        return fieldService.update(field);
    }
}
